using System.Windows.Forms;
using Greg.XmlEditor.Business.Concrete;
using Greg.XmlEditor.Presentation;
using Greg.XmlEditor.Presentation.Presenters;
using Greg.XmlEditor.Presentation.Views;

namespace Greg.XmlEditor
{
	public class Bootstrapper : IBootstrapper
	{
		/// <summary>
		/// Boots the application.
		/// </summary>
		/// <param name="args">
		/// Parameters for the application startup.
		/// </param>
		public void Boot(params string[] args)
		{

			var transformationService = new TransformationService();
			var validationService = new ValidationService();
			var documentService = new DocumentService();
			var documentPresenterFactory = new DocumentPresenterFactory(documentService);
			var interactionManager = new InteractionManager();

			var masterPresenter = new MasterPresenter(documentPresenterFactory, validationService, transformationService, interactionManager);

			if (args != null && args.Length != 0)
			{
				var fileToOpen = args[0];
				masterPresenter.Open(fileToOpen);
			}

			var masterView = new MasterView(masterPresenter);

			Application.Run(masterView);
		}
	}
}